<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <style>
        /* 基础样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }

        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #333;
        }

        /* 登录卡片样式 */
        .login-container {
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            width: 400px;
            padding: 40px;
            transition: all 0.3s ease;
        }

        .login-container:hover {
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
        }

        /* 标题样式 */
        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-header h1 {
            color: #4a4a4a;
            font-size: 28px;
            font-weight: 600;
            margin-bottom: 10px;
        }

        .login-header p {
            color: #888;
            font-size: 14px;
        }

        /* 输入框样式 */
        .input-group {
            margin-bottom: 20px;
            position: relative;
        }

        .input-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            color: #555;
            font-weight: 500;
        }

        .input-group input {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 15px;
            transition: all 0.3s;
        }

        .input-group input:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
            outline: none;
        }

        .input-group .icon {
            position: absolute;
            right: 15px;
            top: 38px;
            color: #999;
        }

        /* 记住我 & 忘记密码 */
        .login-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            font-size: 14px;
        }

        .remember-me {
            display: flex;
            align-items: center;
        }

        .remember-me input {
            margin-right: 8px;
        }

        .forgot-password a {
            color: #667eea;
            text-decoration: none;
        }

        .forgot-password a:hover {
            text-decoration: underline;
        }

        /* 登录按钮 */
        .login-btn {
            width: 100%;
            padding: 14px;
            background: linear-gradient(to right, #667eea, #764ba2);
            border: none;
            border-radius: 6px;
            color: white;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
        }

        .login-btn:hover {
            background: linear-gradient(to right, #5a6fd1, #6a4298);
            transform: translateY(-2px);
        }

        /* 注册链接 */
        .register-link {
            text-align: center;
            margin-top: 25px;
            font-size: 14px;
            color: #666;
        }

        .register-link a {
            color: #667eea;
            text-decoration: none;
            font-weight: 500;
        }

        .register-link a:hover {
            text-decoration: underline;
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .login-container {
                width: 90%;
                padding: 30px 20px;
            }
        }

        /* 错误提示 */
        .error-message {
            color: #ff4757;
            font-size: 13px;
            margin-top: 5px;
            display: none;
        }
    </style>
</head>
<body>
<div class="login-container">
    <div class="login-header">
        <h1>欢迎回来</h1>
        <p>请输入您的账号和密码进行登录</p>
    </div>

    <form id="loginForm">
        <div class="input-group">
            <label for="username">用户名</label>
            <input type="text" id="username" placeholder="请输入用户名" required>
            <div class="error-message" id="username-error"></div>
        </div>

        <div class="input-group">
            <label for="password">密码</label>
            <input type="password" id="password" placeholder="请输入密码" required>
            <div class="error-message" id="password-error"></div>
        </div>

        <div class="login-options">
            <div class="remember-me">
                <input type="checkbox" id="remember">
                <label for="remember">记住我</label>
            </div>
            <div class="forgot-password">
                <a href="#">忘记密码?</a>
            </div>
        </div>

        <button type="submit" class="login-btn">登 录</button>
    </form>

    <div class="register-link">
        还没有账号? <a href="#">立即注册</a>
    </div>
</div>

<script>
    document.getElementById('loginForm').addEventListener('submit', function(e) {
        e.preventDefault();

        // 获取输入值
        const username = document.getElementById('username').value.trim();
        const password = document.getElementById('password').value.trim();
        const rememberMe = document.getElementById('remember').checked;

        // 重置错误信息
        document.getElementById('username-error').style.display = 'none';
        document.getElementById('password-error').style.display = 'none';

        // 简单验证
        let isValid = true;

        if (username === '') {
            document.getElementById('username-error').textContent = '请输入用户名';
            document.getElementById('username-error').style.display = 'block';
            isValid = false;
        }

        if (password === '') {
            document.getElementById('password-error').textContent = '请输入密码';
            document.getElementById('password-error').style.display = 'block';
            isValid = false;
        } else if (password.length < 6) {
            document.getElementById('password-error').textContent = '密码长度不能少于6位';
            document.getElementById('password-error').style.display = 'block';
            isValid = false;
        }

        if (isValid) {
            // 这里可以添加实际的登录逻辑
            console.log('登录信息:', { username, password, rememberMe });

            // 模拟登录成功
            alert('登录成功!');

            // 如果需要跳转
            // window.location.href = 'dashboard.html';
        }
    });

    // 添加输入框动画效果
    const inputs = document.querySelectorAll('.input-group input');
    inputs.forEach(input => {
        input.addEventListener('focus', function() {
            this.parentNode.querySelector('label').style.color = '#667eea';
        });

        input.addEventListener('blur', function() {
            this.parentNode.querySelector('label').style.color = '#555';
        });
    });
</script>
</body>
</html>